#ifndef __LOGFILE_H
#define __LOGFILE_H

#include <stdio.h>
#define MaxFile 5
class LogFile {
	private:
		int rectype;
		FILE *fr[MaxFile];
	public:
		int recflag;
		void setrec( int type, const char *fn ) {	rectype|=1<<type;	fr[type]=fopen( fn, "wt" );	 }	
		void rec( int xr, int xi, int type ) {	if( (rectype&(1<<type)) && recflag )	fprintf(fr[type],"%d %d\n",xr,xi); }
		~LogFile() {	for( int type=0;type<MaxFile;type++ ) if( (rectype&(1<<type)) )	fclose(fr[type]); }
		LogFile( ) { rectype=0; recflag=1; }
};

#endif
